<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>添加精品工程</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<link rel="stylesheet" href="admin/css/common.css" type="text/css" />
	<link rel="stylesheet" href="admin/css/provider.css" type="text/css" />
	<script type="text/javascript" src="js/jquery-1.7.1.js"></script>
	<link rel="stylesheet" href="./kindeditor/themes/default/default.css" />
	<link rel="stylesheet" href="./kindeditor/plugins/code/prettify.css" />
	<script charset="utf-8" src="./kindeditor/kindeditor.js"></script>
	<script charset="utf-8" src="./kindeditor/lang/zh_CN.js"></script>
	<script charset="utf-8" src="./kindeditor/plugins/code/prettify.js"></script>

	<script type="text/javascript">
		<!--
		KindEditor.ready(function(K) {
			var editor1 = K.create('textarea[name="project.content"]', {
				cssPath : 'kindeditor/plugins/code/prettify.css',
				uploadJson : 'kindeditor/jsp/upload_json.jsp',
				fileManagerJson : 'kindeditor/jsp/file_manager_json.jsp',
				allowFileManager : true,
				afterCreate : function() {
					var self = this;
					K.ctrl(document, 13, function() {
						self.sync();
						document.forms['projectForm'].submit();
					});
					K.ctrl(self.edit.doc, 13, function() {
						self.sync();
						document.forms['projectForm'].submit();
					});
				}
			});
			prettyPrint();
		});

		//判断是否为空
		function check(){
			if($('#title').val()==""){
				$('#titleTip').text("*名字不能为空");
				$('#title').focus();
				return false;
			}else{
			//检查图片
				var fileext = document.getElementById("iconFile").value.substring(document.getElementById("iconFile").value.lastIndexOf("."),document.getElementById("iconFile").value.length);
				fileext=fileext.toLowerCase();
				if ((fileext!='.jpg')&&(fileext!='.gif')&&(fileext!='.jpeg')&&(fileext!='.png')&&(fileext!='.bmp')){
					alert("对不起，系统仅支持标准格式的照片，请您调整格式后重新上传，谢谢 !");
					$('#iconFile').focus();
					return false;
				}else{
					$('#iconFileName').val(fileext);
				}
			}
			return true;
		}
		//-->
	</script>
  </head>
  
  <body>
    <div id="provider_zone">
  	  <form action="project/saveProject.action" name="projectForm" enctype="multipart/form-data" method="post" onsubmit="return check();">
		  <table width="99%" border="0" align="center"  cellpadding="3" cellspacing="1" class="table_style">
		    <tr>
		      <td class="left_title_1">项目名字&nbsp;</td>
		      <td>
				<input class="short-input" type="text" name="project.title" id="title">
				<span class="tip" id="titleTip"></span>
		      </td>
		    </tr>
		    <tr>
		      <td class="left_title_1">项目缩略图&nbsp;</td>
		      <td>
				<input type="file" class="input-file" name="iconFile" id="iconFile">
				<input type="hidden" id="iconFileName" name="iconFileName">
		      </td>
		    </tr>
		    <tr>
		      	<td colspan="2">
		      		<textarea id="content" name="project.content" style="width:99%;height:500px;visibility:hidden;"></textarea>
		      	</td>
		    </tr>
		    <tr>
		    	<td colspan="2"  class="left_title_2">
					<input type="submit" class="input-submit" value="保存">(提交快捷键: Ctrl + Enter)
				</td>
		    </tr>
		  </table>
	  </form>
	</div>
  </body>
</html>
